<template>
  <div class="container">
    <h1>App组件</h1>
    <button @click="getRight">获取子组件</button>

    <my-left></my-left>
    <my-right ref="myright"></my-right>
  </div>
</template>

<script>
import MyLeft from './components/MyLeft.vue'
import MyRight from './components/MyRight.vue'
export default {
  components: { MyLeft, MyRight },
  methods: {
    getRight () {
      this.$refs.myright.show()
    }
  }
}
</script>

<style lang="less" scoped>
h1{
  color: #fe7299;
}
.thin {
  font-weight: 200;
}

// 样式穿透，在父组件中，修改子组件的样式
.container /deep/ p {
  width: 330px;
  height: 50px;
  font-size: 20px;
  background-color: #bcdaea;
}
button{
  width: 150px;
}
</style>